<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<link rel="stylesheet" href="/hospital-system/bootstrap-5.3.0/css/bootstrap.css">
<body>
<nav class="navbar navbar-dark bg-dark ">
  <span class="navbar-brand mb-auto h1 col-lg-2 mr-auto my-10  navbar-nav-scroll">欢迎使用医生管理系统</span>
  <form class="form-inline">
     <input type="button" class="btn btn-outline-success my-2 my-sm-0" 
     onclick="window.location.href='/hospital-system/jsp/system.jsp';" value="退出">
  </form>
</nav>
<form action="${pageContext.request.contextPath}/doctorRegister" method="post" class="mt-3">
			<div class="row">
				<span style="text-align: center;color: red;" id="lockMsg">${sessionScope.lockMsg}</span>

				<div class="col-sm-7 offset-sm-3">

			<div class="mb-3 row">
			    <label for="Dname" class="col-sm-2 col-form-label">用户名:</label>
			    <div class="col-sm-10">
			      <input type="text"  class="btn btn-outline-success my-2 my-sm-0" id="dname" name="dname">
			    </div>
			  </div>
			  
			  <div class="mb-3 row">
			    <label for="Dpassword" class="col-sm-2 col-form-label">密码:</label>
			    <div class="col-sm-10">
			      <input  type="password" class="btn btn-outline-success my-2 my-sm-0" id="dpassword" name="dpassword" onblur="pwd(this.value)">
					<span style="color: red" id="pwderror"></span>
					<span style="color: green" id="pwdsuccess"></span>
			    </div>
			  </div>

					<div class="mb-3 row">
						<label for="Dpassword" class="col-sm-2 col-form-label">验证码:</label>
						<div class="col-sm-10">
							<img src="${pageContext.request.contextPath}/captcha" class="verifyCodeImg" onclick="javascript: _change()" id="vCode" width="21%"  alt="情输入验证码">

						</div>
					</div>
					<div class="mb-3 row">
			    <div class="col-sm-2">
			      <input type="submit" class="form-control btn btn-primary" value="登录" >
			    </div>  
			    		  
			    <div class="col-sm-2 offset-sm-1">
			      <input type="button" class="form-control btn btn-primary" 
			       onclick="window.location.href='/hospital-system/jsp/login.jsp';" value="注册">	
			    </div>
			</div> 	
			</div>
			</div>
 </form>  
</body>
<script src="/hospital-system/js/jquery-3.6.1.min.js"></script>
<script>

	function pwd(password) {
		if(validatePassword(password)){
			$("#pwdsuccess").show();
			$("#pwdsuccess").text("ok");
			$("#pwderror").hide();
		}else{
			$("#pwderror").show();
			$("#pwderror").text("密码必须大于6位并且小于12位且包含大小写字母");
			$("#pwdsuccess").hide();
		}
	}

	function validatePassword(password) {
		// 验证密码长度
		if (password.length < 6 || password.length > 12) {
			return false;
		}

		// 验证是否包含大写字母
		if (!/[A-Z]/.test(password)) {
			return false;
		}

		// 验证是否包含小写字母
		if (!/[a-z]/.test(password)) {
			return false;
		}

		// 密码验证通过
		return true;
	}

</script>
</html>